/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package proyecto3;

/**
 *
 * @author Lucia
 */
import java.util.ArrayList;

public class ConjuntoBuses {

    public ConjuntoBuses() {
        Buses = new ArrayList<>();
    }

    public void agregar(Bus nuevoBus) {
        this.Buses.add(nuevoBus);
    }

    public void setBuses(ArrayList<Bus> Buses) {
        this.Buses = Buses;
    }

    public ConjuntoBuses(ArrayList<Bus> Buses) {
        this.Buses = Buses;
    }

    public void Eliminar(int Id) {
        for (int i = 0; i < Buses.size(); i++) {
            if (Buses.get(i).getId() == Id) {
                Buses.remove(Buses.get(i));
            }
        }
    }

    public int size() {
        return this.Buses.size();
    }

    public Bus get(int i) {
        return this.Buses.get(i);
    }

    @Override
    public String toString() {
        String msj = "\tInicio ConjuntoBuses\n";
        for (int i = 0; i < Buses.size(); i++) {
            msj = msj + Buses.get(i).toString() + "\n";
        }
        msj = msj + "\tFin ConjuntoBuses\n";
        return msj;
    }

    ArrayList<Bus> Buses;
}
